<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试</title>
</head>
<body>
测试微信分享${o.signature}   ${o.nonceStr}  ${o.timestamp}  ${o.appId}
<script src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>

    wx.config({
        debug: true,
        appId: "${o.appId}",
        timestamp:"${o.timestamp}",
        nonceStr: "${o.nonceStr}",
        signature: "${o.signature}",
        jsApiList: [
            'checkJsApi',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'onMenuShareQZone'
        ]
    });
    function getShareOption() {
        var url =window.location.href;
        var op = {
            title: "测试",
            desc: "测试",
            link: url,
            imgUrl: "http://fenghenongchang.image.alimmdn.com/fenghenongchang/img/png/201707041537560020001.png@300w.png",
            success: function (res) {
            },
            fail: function (res) {
            }
        }
        return op;
    }

    function setWxEvent() {
        var option = getShareOption();
        wx.onMenuShareAppMessage(option);

        wx.onMenuShareTimeline(option);

        wx.onMenuShareQQ(option);

        wx.onMenuShareWeibo(option);

        wx.onMenuShareQZone(option);
        console.log("设置分享成功----------------------------");
    }
    wx.ready(function(){
        console.log("商品页面准备完成----------------------------");
        wx.onMenuShareAppMessage({

            title: '测试', // 分享标题

            desc: '测试', // 分享描述

            link: window.location.href, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致

            imgUrl: "http://fenghenongchang.image.alimmdn.com/fenghenongchang/img/png/201707041537560020001.png@50w.png",

            type: 'link',


            success: function () {

                // 用户确认分享后执行的回调函数

            },

            cancel: function () {

                // 用户取消分享后执行的回调函数

            }

        });
    });
    wx.error(function (res) {
    });
</script>
</body>
</html>